package gui;

import java.awt.BorderLayout;

import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import java.awt.GridLayout;
import java.awt.Color;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.JLabel;
import javax.swing.JTextField;
import java.awt.FlowLayout;
import java.awt.Font;
import javax.swing.SwingConstants;

public class StartGUI extends JFrame implements ActionListener {

	private JPanel contentPane;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					StartGUI frame = new StartGUI();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public StartGUI() {
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 450, 300);
		contentPane = new JPanel();
		contentPane.setBackground(new Color(0, 102, 255));
		contentPane.setBorder(new EmptyBorder(100, 100, 100, 100));
		setContentPane(contentPane);
		
		JButton btnAusgabe = new JButton("Ausgabe");
		btnAusgabe.addActionListener(this);
		btnAusgabe.setBounds(23, 152, 125, 39);
		btnAusgabe.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
			}
		});
		contentPane.setLayout(null);
		contentPane.add(btnAusgabe);
		
		JButton btnErstellen = new JButton("Erstellen");
		btnErstellen.addActionListener(this);
		btnErstellen.setBounds(297, 152, 125, 39);
		contentPane.add(btnErstellen);
		
		JButton btnLoeschen = new JButton("L\u00F6schen");
		btnLoeschen.addActionListener(this);
		btnLoeschen.setBounds(160, 152, 125, 39);
		contentPane.add(btnLoeschen);
		
		JLabel lblCarDirect = new JLabel("Car Direct");
		lblCarDirect.setHorizontalAlignment(SwingConstants.CENTER);
		lblCarDirect.setFont(new Font("Lucida Grande", Font.PLAIN, 64));
		lblCarDirect.setBounds(17, 6, 405, 64);
		contentPane.add(lblCarDirect);
	}

	@Override
	public void actionPerformed(ActionEvent event) {
		if(event.getActionCommand().equals("Erstellen"))
		{
			new ErfassenGUI().setVisible(true);
			this.dispose();
		}
		else if(event.getActionCommand().equals("L\u00F6schen")){
			new LoeschenGUI().setVisible(true);
			this.dispose();
		}
		else if(event.getActionCommand().equals("Ausgabe")){
			new AusgabeGUI().setVisible(true);
			this.dispose();
		}
	}
}
